﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<HTML lang="en">

	<HEAD>
		<META content="IE=10.000" http-equiv="X-UA-Compatible">

		<META charset="utf-8">
		<META name="viewport" content="width=device-width, initial-scale=1.0">
		<TITLE>运营管理后台</TITLE>
		<!-- CSS -->
		<LINK href="css/OpenSans.css" rel="stylesheet" type="text/css">
		<LINK href="css/bootstrap.min.css" rel="stylesheet">
		<LINK href="css/jasny-bootstrap.min.css" rel="stylesheet">
		<LINK href="css/font-awesome.css" rel="stylesheet" type="text/css">
		<LINK href="css/daterangepicker-bs3.css" rel="stylesheet" type="text/css">
		<LINK href="css/datepicker.css" rel="stylesheet" type="text/css">
		<LINK href="css/select2.css" rel="stylesheet" type="text/css">
		<LINK href="css/select2-bootstrap.css" rel="stylesheet" type="text/css">
		<LINK href="css/uniform.default.min.css" rel="stylesheet" type="text/css">
		<!--<link href="scripts/css/prettify.css" rel="stylesheet" type="text/css" />
        <link href="http://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.10/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />-->
		<LINK href="css/fullcalendar.css" rel="stylesheet">
		<LINK href="css/fullcalendar.print.css" rel="stylesheet" media="print">
		<LINK href="css/toastr.min.css" rel="stylesheet">
		<LINK href="css/ark.css" rel="stylesheet" type="text/css">
		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
            <script src="/manager/js/html5shiv.js"></script>
            <script src="/manager/js/respond.min.js"></script>
        <![endif]-->

		<SCRIPT src="js/jquery.min.js"></SCRIPT>

		<META name="GENERATOR" content="MSHTML 10.00.9200.17457">
	</HEAD>

	<BODY class="cover">
		<DIV class="login-wrap">
			<DIV class="col-md-12 text-center">
				<H1></H1>
			</DIV>
			<DIV class="panel">
				<DIV class="panel-heading">
					<H3 class="panel-title">运营管理后台</H3>
				</DIV>
				<DIV class="panel-body">
					<FORM role="form" method="post" action="welcome.jsp">
						<DIV class="form-group">
							<INPUT name="phone" class="form-control" required="required" type="number" placeholder="用户手机号" value="">
						</DIV>
						<DIV class="form-group">
							<INPUT name="password" class="form-control" required="required" type="password" placeholder="Password" value="">
						</DIV>
						<DIV class="form-group">
							<LABEL><INPUT name="code" class="form-control" id="inputCode" 
required="required" type="number" maxlength="4" placeholder="验证码" 
value=""></LABEL>
							<A id="aCode">
								<IMG id="captcha" src="css/captcha.png">
							</A>
						</DIV>
						<DIV class="checkbox">
							<LABEL><INPUT name="keep" type="checkbox">记住登录状态           
          </LABEL> </DIV>
						<BUTTON class="btn btn-primary" type="submit">登录</BUTTON>
						<BR>
						<BR>
					</FORM>
				</DIV>
			</DIV>
		</DIV>
		<!-- JS -->
		<SCRIPT src="js/jquery-ui.min.js"></SCRIPT>

		<SCRIPT src="js/jquery.uniform.min.js"></SCRIPT>

		<SCRIPT src="js/bootstrap.min.js"></SCRIPT>

		<SCRIPT src="js/jasny-bootstrap.min.js"></SCRIPT>

		<SCRIPT src="js/jquery.autosize.min.js"></SCRIPT>

		<SCRIPT src="js/moment.min.js"></SCRIPT>

		<SCRIPT src="js/daterangepicker.js"></SCRIPT>

		<SCRIPT src="js/bootstrap-datepicker.js"></SCRIPT>

		<SCRIPT src="js/fullcalendar.min.js"></SCRIPT>
		<!-- <script src="/manager/vendor/dropzone/dist/min/dropzone.min.js"></script> -->
		<SCRIPT src="js/select2.min.js"></SCRIPT>

		<SCRIPT src="js/base.js"></SCRIPT>
		<!-- <script src="/manager/js/ark.js"></script> -->
		<SCRIPT src="js/toastr.min.js"></SCRIPT>

		<SCRIPT src="js/admin.js"></SCRIPT>

		<SCRIPT src="js/md5.min.js" type="text/javascript"></SCRIPT>

		<SCRIPT type="text/javascript">
			$(function() {
				$("#captcha").on("click", function() {
					$('#captcha').prop('src', '/captcha?width=70&height=30&random=' + Math.random());
				});
			})

			var phoneStatus = false;
			var pwdStatus = false;
			var codeStatus = false;

			$('input[name=code]').change(function() {
				_checkcode();
			});
			$('input[name=phone]').blur(function() {
				_checkPhone();
			});
			$('input[name=password]').blur(function() {
				_checkPassword()
			});

			function _checkPhone() {
				var phone = $('input[name=phone]').val();
				var reg = /^1\d{10}$/;
				var status = true;
				if(!phone || !reg.test(phone)) {
					mind.alert('手机格式错误');
					$('input[name=phone]').parent().addClass('has-error');
					phoneStatus = false;
				} else {
					$('input[name=phone]').parent().removeClass('has-error');
					phoneStatus = true;
				}
			}

			function _checkPassword() {
				var pwd = $('input[name=password]').val();
				var regPwd = /^[a-z0-9|\~!@#\$%\^&\*\(\)\[\]\{\}:;\',\.<>?_\+=\-]{6,16}$/i
				if(!pwd || !regPwd.test(pwd)) {
					mind.alert('密码应为6〜16位');
					pwdStatus = false;
					$('input[name=password]').parent().addClass('has-error');
				} else {
					pwdStatus = true;
					$('input[name=password]').parent().removeClass('has-error');
				}
			}
			//注释掉验证码校验
			/* function _checkcode() {
				if($('input[name=code]').val().length === 4) {
					$.post('/captcha', {
						captcha: $('input[name=code]').val()
					}, function(result) {
						if(result.code === 0) {
							$('input[name=code]').parent().removeClass('has-error');
							codeStatus = true;
						} else {
							mind.alert('验证码错误');
							codeStatus = false;
							$('input[name=code]').parent().addClass('has-error');
						}
					});
				} else {
					codeStatus = false;
					$('input[name=code]').parent().addClass('has-error');
				}
			} */

			$('form').on('submit', function checkForm() {
				_checkPhone();
				_checkPassword();
				_checkcode();
				if(phoneStatus && pwdStatus && codeStatus) {
					var pwd = $('input[name=password]').val();
					$('input[name=password]').val(md5(pwd));
				} else {
					if(!phoneStatus) {
						mind.alert("电话号码有误");
					}
					if(!pwdStatus) {
						mind.alert("密码有误");
					}
					if(!codeStatus) {
						mind.alert("验证码有误");
					}
					return false;
				}
			})
		</SCRIPT>
	</BODY>

</HTML>